home *** CD-ROM | disk | FTP | other *** search
/ Apple Service Source 1996 February / Service Source 2.0 1996 Companion.iso / AppleOrder / Program / AppleOrder CCL Folder / XUSA Software_MNP.CCL < prev   
Encoding:
Text File  |  1993-03-22  |  25.5 KB  |  786 lines  |  [TEXT/MPS ]

  1. !================================================================
  2. !    XUSA Software_MNP.CCL
  3. !================================================================
  4. !
  5. ! USA modem CCL script using software MNP protocol
  6. !
  7. !    Change History-
  8. !        v1.0        09/21/90    gs:General Release Version
  9. !        v1.0.2        12/07/90    gs:Create minor release version
  10. !        v2.0d1        12/3/91        gs:Supports ModemCmd and ConnectStr parameters
  11. !        v2.0        9/7/92        gs:General Release Version
  12. !                    10/21/92    gs:Changed Label 80 code so that it tries at least 4 times to
  13. !                                sync up in Requesting Network attention before resetting modem.
  14. !        v2.0.1        2/3/93        gs:Changed "CARRIER" to "NO CARRIER", cleaned up CCL
  15. !                                and other miscellaneous changes
  16. !        v2.0.2        3.16.93        gs:added some delay to label 60 when waiting for a response
  17. !
  18. !    The following label ranges (0-255) are defined for all scripts:
  19. !
  20. !    Label        Function
  21. !    -----        --------
  22. !    0-19        Communications Setup
  23. !    20-39        Get a Modem
  24. !    40-59        Modem Setup
  25. !    60-79        Dialing
  26. !    80-99        Physical Connection
  27. !    100-119        GEIS Logon
  28. !    120-139        CICS
  29. !    140-159        APPM
  30. !    160-179        Online
  31. !    180-199        Terminate Session
  32. !    200-209        Cancel
  33. !    210-219        Hangup
  34. !    230-239        <UNUSED>
  35. !    240-255        Disconnect
  36. !
  37. !    Note:        Label 210 is the modem hangup sequence
  38. !                Label 240 is reserved as the start of the disconnect sequence
  39. !
  40. !================================================================================
  41. -LABEL 0    !***<Physical connection entry point>*** Initialize Communications
  42. !================================================================================
  43. !
  44. !    Select the MNPSerial Tool, initialize some parameters and open the session.
  45. !
  46. !    CTBTOOL <Toolname> [<LabelIfToolDoesn'tExist>] [<LabelIfError>] [<ctb flags>] [<buffer sizes>]
  47. CTBTool "MNPSerial Tool" 4 5
  48. !    CTBPARAMETER <ParameterName> <NewValue> [<LabelIfError>]
  49. CTBParameter MNPAutoEngage On 6
  50. CTBParameter MNPAutoengageString "CONNECT ~Baud\13" 7
  51. CTBParameter MNPConnectionMode Initiator 8
  52. CTBParameter MNPAutoEngageDelay 30 9
  53. CTBParameter MNPConnectAtOpen No 10
  54. CTBParameter MNPCloseConnectionIfMNPFails Yes 11
  55. CTBParameter Baud ~Baud 12
  56. CTBParameter Port "~MPrt" 13
  57. !    Dont set Data, Stop, or Parity bits for S/W MNP (defaults to 8,1,0 in the tool)
  58. DsplyMsg Opening the connection...
  59. !
  60. !    CTBOPEN [<LabelIfOpenFails>] [<LabelIfError>]
  61. CTBOpen 14 15        ! Open the Communications session
  62. !
  63. !    Flush any data, Initialize script variables and define Cancel label
  64. Flush                ! clear input buffer and ring buffer
  65. CanBtn 200            ! If user cancels, take the error return
  66. !
  67. SetVar 1 0            ! #of consecutive no responses to hangup command
  68. SetVar 2 0            ! #of consecutive no responses to modem configuration command
  69. SetVar 3 0            ! #of consecutive network contact failures.
  70. SetVar 4 0            ! #of logon validation failures
  71. SetVar 5 0            ! #of consecutive CICS90  failures
  72. SetVar 6 0            ! #of consecutive APPM failures
  73. SetVar 7 0            ! flag to indicate if connecting(0) or disconnecting(1)
  74. SetVar 8 0            ! not used
  75. !
  76. Jump 40                ! Go to Modem Selection and Setup
  77. !
  78. !*********
  79. -LABEL 4    !---<MNPSerial Tool missing>---
  80. !*********
  81. Alert -1 The MNP Serial tool cannot be found in your System folder.\13Please install it, and try again.
  82. Exit -1                ! exit the script with an error
  83. !
  84. !*********
  85. -LABEL 5    !---<CTBTool Comm Toolbox err>---
  86. !*********
  87. Alert -1 A CTBTool error has occurred in the Communications Toolbox.\13Please try again.\13If the problem continues, call the Apple USA helpline.
  88. Exit -1                ! exit the script with an error.
  89. !
  90. !*********
  91. -LABEL 6    !---<CTBParameter MNPAutoengage failed>---
  92. !*********
  93. Alert -1 CTBParameter MNPAutoengage caused an error.
  94. Exit -1                ! exit the script with an error.
  95. !
  96. !*********
  97. -LABEL 7    !---<CTBParameter MNPAutoengageString failed>---
  98. !*********
  99. Alert -1 CTBParameter MNPAutoengageString caused an error.
  100. Exit -1                ! exit the script with an error.
  101. !
  102. !*********
  103. -LABEL 8    !---<CTBParameter MNPConnectionMode failed>---
  104. !*********
  105. Alert -1 CTBParameter MNPConnectionMode caused an error.
  106. Exit -1                ! exit the script with an error.
  107. !
  108. !*********
  109. -LABEL 9    !---<CTBParameter MNPAutoEngageDelay failed>---
  110. !*********
  111. Alert -1 CTBParameter MNPAutoEngageDelay caused an error.
  112. Exit -1                ! exit the script with an error.
  113. !
  114. !*********
  115. -LABEL 10    !---<CTBParameter MNPConnectAtOpen failed>---
  116. !*********
  117. Alert -1 CTBParameter MNPConnectAtOpen caused an error.
  118. Exit -1                ! exit the script with an error.
  119. !
  120. !*********
  121. -LABEL 11    !---<CTBParameter MNPCloseConnectionIfMNPFails failed>---
  122. !*********
  123. Alert -1 CTBParameter MNPCloseConnectionIfMNPFails caused an error.
  124. Exit -1                ! exit the script with an error.
  125. !
  126. !*********
  127. -LABEL 12    !---<CTBParameter Baud failed>---
  128. !*********
  129. Alert -1 CTBParameter Baud caused an error.
  130. Exit -1                ! exit the script with an error.
  131. !
  132. !*********
  133. -LABEL 13    !---<CTBParameter Port failed>---
  134. !*********
  135. Alert -1 CTBParameter Port caused an error.
  136. Exit -1                ! exit the script with an error.
  137. !
  138. !*********
  139. -LABEL 14    !---<CTBOpen failed>---
  140. !*********
  141. Alert -1 CTBOpen could not open communications.\13The serial port may already be in use.
  142. Exit -1                ! exit the script with an error.
  143. !
  144. !**********
  145. -LABEL 15    !---<CTBOpen err>---
  146. !**********
  147. Alert -1 CTBOpen caused an Communications Toolbox error.
  148. Exit -1                ! exit the script with an error.
  149. !
  150. !================================================================================
  151. -LABEL 40    !***<Modem Setup>*** Modem Reset and Setup
  152. !================================================================================
  153. DsplyPic 1
  154. DsplyMsg Making sure the modem is ready...
  155. Jsr 210                ! Hang up (just in case)
  156. SetVar 1 0            ! clear # hangup tries counter
  157. !
  158. !**********
  159. -LABEL 42    ! ---<Got modem attention>---
  160. !**********
  161. DsplyMsg Setting modem parameters...
  162. !    Clear all previous MatchStr's and setup the modem
  163. MatchStr 1 42 Dummy
  164. Wait 30
  165. !    Send modem setup commands
  166. Xmit ~HCMD\13
  167. MatchStr 1 60 OK
  168. Wait 300               ! wait up to 5 secs for a response
  169. IncVar 2            ! increment # modem setup tries
  170. IfVar 2 3 44        ! if 3 tries, display Modem Configuration Alert
  171. DsplyMsg Modem not responding to setup commands. Retrying...
  172. Jump 42                ! else try modem setup again
  173. !
  174. !**********
  175. -LABEL 44    ! ---<Modem configuration err>---
  176. !**********
  177. Bell
  178. Alert 200 The modem is not responding to setup commands.\13Turn the modem off and then on again before retrying.
  179. SetVar 2 0            ! clear # modem setup tries
  180. Jump 40                ! reset modem and try again
  181. !
  182. !================================================================================
  183. -LABEL 60    !***<Modem ready>*** Dial phone
  184. !================================================================================
  185. DsplyMsg Dialing ~Fone...
  186. DsplyPic 2
  187. !    Clear all previous MatchStr's (No comments on same line as MatchStr's)
  188. MatchStr 1 60 Dummy
  189. SetVar 2 0            ! clear #modem setup tries
  190. Wait 30                ! Give modem .5 secs to get ready before sending the attention chars
  191. Xmit ATD~Tone~Fone\13
  192. !    Look for one of the following expected responses
  193. MatchStr 1 80 ~GSTR
  194. MatchStr 2 62 ERROR
  195. MatchStr 3 66 NO CARRIER
  196. MatchStr 4 70 BUSY
  197. MatchStr 5 74 NO DIAL
  198. Wait 2000            ! wait about 30 secs for a response
  199. !
  200. !**********
  201. -LABEL 62    !---<No response or ERROR from modem>---
  202. !**********
  203. IncVar 3            ! Increment # dial attempts counter
  204. IfVar 3 4 64        ! if 4 attempts, display No Dial Response Alert
  205. DsplyMsg Modem does not respond to Dial command. Retrying...
  206. Jump 40                ! reset modem and try again
  207. !
  208. !**********
  209. -LABEL 64    !---<No dial response err>---
  210. !**********
  211. Bell
  212. Alert 200 The modem is not responding to dial command.\13Make sure your modem is connected to a phone line.
  213. SetVar 3 0            ! clear # dial attempts counter
  214. Jump 40                ! reset modem and try again
  215. !
  216. !**********
  217. -LABEL 66   !---<No Carrier>---
  218. !**********
  219. IncVar 3            ! Increment # dial attempts counter
  220. IfVar 3 4 68        ! if 4 attempts, display No Carrier Alert
  221. DsplyMsg No Carrier with phone number dialed. Retrying...
  222. Jump 40                ! reset modem and try again
  223. !
  224. !**********
  225. -LABEL 68    !---<No carrier err>---
  226. !**********
  227. Bell
  228. Alert 200 Cannot detect carrier signal after dialing.\13Make sure the phone number provided is correct.
  229. SetVar 3 0            ! clear # dial attempts counter
  230. Jump 40                ! reset modem and try again
  231. !
  232. !**********
  233. -LABEL 70    !---<busy>---
  234. !**********
  235. IncVar 3            ! Increment # dial attempts counter
  236. IfVar 3 4 72        ! if 4 attempts, display Busy Alert
  237. DsplyMsg Phone number dialed is busy. Pausing before retrying...
  238. Wait 300            ! wait 5 secs
  239. DsplyMsg Retrying...
  240. Jump 40                ! reset modem and try again
  241. !
  242. !**********
  243. -LABEL 72    !---<Busy err>---
  244. !**********
  245. Bell
  246. Alert 200 All network access lines are in use.\13Try again later.
  247. SetVar 3 0            ! clear # dial attempts counter
  248. Jump 40                ! reset modem and try again
  249. !
  250. !**********
  251. -LABEL 74    !---<No Dialtone>---
  252. !**********
  253. IncVar 3            ! Increment # dial attempts counter
  254. IfVar 3 4 76        ! if 4 attempts, display No Dialtone Alert
  255. DsplyMsg Modem reports no dial tone. Retrying...
  256. Jump 40                ! reset modem and try again
  257. !
  258. !**********
  259. -LABEL 76   !---<No dialtone Error>---
  260. !**********
  261. Bell
  262. Alert 200 Modem reports no dial tone.\13Make sure your modem is connected to a phone line.
  263. SetVar 3 0            ! clear # dial attempts counter
  264. Jump 40                ! reset modem and try again
  265. !
  266. !================================================================================
  267. -LABEL 80    !***<Establish Physical Connection>*** Send H's to identify us to network
  268. !================================================================================
  269. DsplyMsg Requesting network attention...
  270. !    Look for one of the following expected responses
  271. MatchStr 1 84 NO CARRIER
  272. MatchStr 2 100 U#
  273. Xmit HH
  274. Wait 600            ! Allow 10 seconds for the U# to show up
  275. IncVar 3            ! No U#, increment # dial attempts counter
  276. IfVar 3 4 82        ! if 4 attempts, display No U# Alert
  277. Jump 80                ! else try again
  278. !
  279. !**********
  280. -LABEL 82    !---<No U#>---
  281. !**********
  282. Bell
  283. Alert 200 Unable to get the network's attention.\13Make sure you have the correct phone number.
  284. SetVar 3 0            ! clear # dial attempts counter
  285. Jump 40                ! reset modem and try again
  286. !
  287. !**********
  288. -LABEL 84    !---<Line dropped>---
  289. !**********
  290. IncVar 3            ! Increment # dial attempts counter
  291. IfVar 3 4 86        ! if 4 attempts, display Line Dropped Alert
  292. DsplyMsg Carrier signal dropped before network recognition. Retrying...
  293. Jump 40                ! reset modem and try again
  294. !
  295. !**********
  296. -LABEL 86   !---<Line dropped Err>---
  297. !**********
  298. Bell
  299. Alert 200 Carrier signal dropped before network recognition.\13Try again.
  300. SetVar 3 0            ! clear # dial attempts counter
  301. Jump 40                ! reset modem and try again
  302. !
  303. !================================================================================
  304. -LABEL 100    !***<GEIS logon>***
  305. !================================================================================
  306. !
  307. DsplyMsg Physical Connection established. Logging on to network...
  308. DsplyPic 3
  309. SetVar 3 0            ! clear # dial attempts counter
  310. Wait 6                ! wait 0.1 sec
  311. Flush                ! clear input buffer
  312. !    Note: leave 2 spaces between ~Dist and ~Numb
  313. Xmit ~User,~Dist  ~Numb,~Ridn\13
  314. !
  315. !    Look for one of the following expected responses
  316. MatchStr 1 104 NO CARRIER
  317. MatchStr 2 106 DISCONNECTED
  318. MatchStr 3 120 ===>
  319. MatchStr 6 108 N FAULT,
  320. MatchStr 7 108 T FORMAT,
  321. MatchStr 8 110 L DENIED
  322. MatchStr 9 112 BUSY
  323. MatchStr 10 112 DOWN
  324. Wait 600            ! wait up to 10 seconds for a response
  325. IncVar 4            ! Increment # logon attempts counter
  326. IfVar 4 3 102        ! if 3 tries, display No Login Response alert 
  327. DsplyMsg No logon response from network. Retrying...
  328. Jump 100            ! try again
  329. !
  330. !*********
  331. -LABEL 102    !---<No Logon response>---
  332. !*********
  333. Bell
  334. Alert 200 No logon response from network.\13Try again.
  335. SetVar 4 0            ! clear # logon attempts counter
  336. Jump 40                ! reset modem and try again
  337. !
  338. !*********
  339. -LABEL 104    !---<Carrier dropped>---
  340. !*********
  341. IncVar 4            ! Increment # login attempts counter
  342. IfVar 4 3 105        ! if 3 attempts, display Carrier dropped alert
  343. DsplyMsg Carrier signal dropped during network logon. Retrying...
  344. Jump 40                ! reset modem and try again
  345. !
  346. !*********
  347. -LABEL 105    !---<Carrier dropped Err>---
  348. !*********
  349. Bell
  350. Alert 200 Carrier signal dropped during network logon.\13Try again.
  351. SetVar 4 0            ! clear # logon attempts counter
  352. Jump 40                ! reset modem and try again
  353. !
  354. !*********
  355. -LABEL 106    !---<Session disconnected>---
  356. !*********
  357. IncVar 4            ! Increment # logon attempts counter
  358. IfVar 4 3 107        ! if 3 attempts, display Session disconnected alert
  359. DsplyMsg Network connection dropped during network logon. Retrying...
  360. Jump 40                ! reset modem and try again
  361. !
  362. !*********
  363. -LABEL 107    !---<Session disconnected Err>---
  364. !*********
  365. Bell
  366. Alert 200 Network connection dropped during network logon.\13Try again.
  367. SetVar 4 0            ! clear # logon attempts counter
  368. Jump 40                ! reset modem and try again
  369. !
  370. !*********
  371. -LABEL 108    !---<Validation fault>---
  372. !*********
  373. IncVar 4            ! Increment # logon attempts counter
  374. IfVar 4 3 109        ! see if limit of 3 is exceeded.
  375. DsplyMsg Network rejected your identification. Retrying...
  376. Wait 60                ! wait 1 sec
  377. Jump 100            ! retry GEIS login (only case where we don't reset)
  378. !
  379. !*********
  380. -LABEL 109    !---<validation fault err>---
  381. !*********
  382. Bell
  383. Alert 200 Your network identification has been rejected.\13Check Setup to make sure your identification is correct.
  384. SetVar 4 0            ! clear # logon attempts counter
  385. Jump 40                ! reset modem and try again
  386. !
  387. !*********
  388. -LABEL 110    !---<Denied by host>---
  389. !*********
  390. IncVar 4            ! Increment # logon attempts counter
  391. IfVar 4 3 111        ! if 3 attempts, display Network Problem alert
  392. DsplyMsg Network host equipment problem detected. Retrying...
  393. Jump 40                ! reset modem and try again
  394. !
  395. !*********
  396. -LABEL 111    !---<Denied by host err>---
  397. !*********
  398. Bell
  399. Alert 200 Network host equipment problem detected.\13Try again.
  400. SetVar 4 0            ! clear # logon attempts counter
  401. Jump 40                ! reset modem and try again
  402. !
  403. !*********
  404. -LABEL 112    !---<MARK3K access busy/down>---
  405. !*********
  406. IncVar 4            ! Increment # logon attempts counter
  407. IfVar 4 3 113        ! if 3 attempts, display Network Busy alert
  408. DsplyMsg Network equipment busy/down. Retrying...
  409. Jump 40                ! reset modem and try again
  410. !
  411. !*********
  412. -LABEL 113    !---<MARK3K access busy/down err>---
  413. !*********
  414. Bell
  415. Alert 200 Network equipment busy or down.\13Try again.
  416. SetVar 4 0            ! clear # logon attempts counter
  417. Jump 40                ! reset modem and try again
  418. !
  419. !================================================================================
  420. -LABEL 120    !***<MARK3000 prompt>*** Invoke CICS
  421. !================================================================================
  422. !
  423. DsplyMsg Requesting access to network subsystem...
  424. DsplyPic 4
  425. Wait 6                ! wait 0.1 secs
  426. Flush                ! clear input buffer
  427. !
  428. Xmit ~CICS\13
  429. !    Look for one of the following expected responses
  430. MatchStr 3 140 READY
  431. !    To overcome a network problem, the following label was changed from 124 to 126
  432. !    MatchStr 4 124 T BOUND
  433. MatchStr 4 126 T BOUND
  434. MatchStr 5 126 UNRECOGN
  435. MatchStr 6 126 ===>
  436. Wait 3600            ! Allow 60 secs for the expected responses to show up
  437. IncVar 5            ! Timeout, so increment # CICS tries counter
  438. IfVar 5 2 122        ! if 3 tries, display No Response alert
  439. DsplyMsg No response to network subsystem request. Retrying...
  440. Jump 40                ! reset modem and try again
  441. !
  442. !*********
  443. -LABEL 122    !---<No CICS err>---
  444. !*********
  445. Bell
  446. Alert 200 No response to network subsystem request.\13Try again.
  447. SetVar 5 0            ! clear # CICS tries counter
  448. Jump 40                ! reset modem and try again
  449. !
  450. !*********
  451. -LABEL 124    !---<Session not bound err>---
  452. !*********
  453. Bell
  454. Alert 200 Network CICS subsystem needs to be started.\13Please contact the Apple USA helpline immediately.
  455. Jump 200            ! jump to cancel routine
  456. !
  457. !*********
  458. -LABEL 126    !---<Invalid application>---
  459. !*********
  460. IncVar 5            ! Increment # CICS tries counter
  461. IfVar 5 3 127        ! if 3 tries, display Invalid Application alert
  462. DsplyMsg Network subsystem request has been rejected. Retrying...
  463. Wait 60                ! wait 1 sec
  464. Flush
  465. Jump 120            ! try to access CICS again
  466. !
  467. !*********
  468. -LABEL 127    !---<Invalid application err>---
  469. !*********
  470. Bell
  471. Alert 200 The network subsystem request has been rejected.\13Try again.
  472. SetVar 5 0            ! clear # CICS tries counter
  473. Flush
  474. Jump 40                ! reset modem and try again
  475. !
  476. !================================================================================
  477. -LABEL 140    !***<CICS ready>*** Start APPM transaction
  478. !================================================================================
  479. !
  480. DsplyMsg Requesting access to distribution center ~Dist...
  481. DsplyPic 5            ! Highlight box 5 on screen
  482. SetVar 5 0            ! clear # CICS tries counter
  483. !                    ! Send what needs to be sent
  484. Xmit ~Epgm~Dist\13
  485. !    Look for one of the following expected responses
  486. Wait 12                ! wait 0.2 secs
  487. Flush                ! clear input buffer
  488. !    Look for one of the following expected responses
  489. MatchStr 3 160 C100
  490. MatchStr 4 144 INVALID
  491. Wait 3600            ! Allow 60 secs for the expected responses to show up
  492. !
  493. IncVar 6            ! Timeout, so Increment # APPM tries counter
  494. IfVar 6 2 142        ! if 2 tries, display No Transaction alert
  495. DsplyMsg No response to distribution center access request. Retrying...
  496. Jump 40                ! reset modem and try again
  497. !
  498. !*********
  499. -LABEL 142    !---<No transaction response>---
  500. !*********
  501. Bell
  502. Alert 200 No response to distribution center access.\13Try again.
  503. SetVar 6 0            ! reset # APPM tries counter
  504. Jump 40                ! reset modem and try again
  505. !
  506. !*********
  507. -LABEL 144    !---<Invalid transaction>---
  508. !*********
  509. IncVar 6            ! Increment # APPM tries counter
  510. IfVar 6 2 145        ! if 2 tries, display Invalid Transaction alert
  511. DsplyMsg Distribution center access request rejected. Retrying...
  512. Jump 40                ! reset modem and try again
  513. !
  514. !*********
  515. -LABEL 145    !---<Invalid transaction err>---
  516. !*********
  517. Bell
  518. Alert 200 Distribution center access request rejected.\13Check Setup to make sure your identification is correct.
  519. SetVar 6 0            ! reset # APPM tries counter
  520. Jump 40                ! reset modem and try again
  521. !
  522. !================================================================================
  523. -LABEL 160    !***<Online>***
  524. !================================================================================
  525. !
  526. Wait 60                ! wait 1 sec
  527. DsplyMsg Accessing the distribution center ~Dist...
  528. DsplyPic 6            ! Highlight box 6 on screen
  529. !    C9 = pass msg thru GE, 899 = Echo cmd
  530. Xmit C9899Ole\13
  531. !    Look for one of the following expected responses
  532. MatchStr 2 162 C5
  533. MatchStr 3 164 Ole\13
  534. Wait 7200            ! wait 2 minutes for echo back or distribution center nonavail msg
  535. !
  536. !*********
  537. -LABEL 162    !---<no luck this time>--- 
  538. !*********
  539. DsplyMsg Distribution center is not available...
  540. Jsr 180                ! terminate session
  541. Bell
  542. Alert -1 Distribution center is not available.\13Please try again later.
  543. Jump 200            ! exit to Cancel routine
  544. !
  545. !*********
  546. -LABEL 164    !---<Success, but did MNP sync up?>--- 
  547. !*********
  548. !
  549. !    CTBCHECKPARAMETER <ParameterName> <ValueToCheckAgainst>
  550. !                      <LabelIfMatch> [<LabelIfParameterNotFound>] [<LabelIfError>]
  551. CTBCheckParameter MNPStatus On 170 168 169
  552. CTBCheckParameter MNPStatus Off 165 168 169
  553. CTBCheckParameter MNPStatus Connecting 166 168 169
  554. CTBCheckParameter MNPStatus Disconnecting 167 168 169
  555. !
  556. DisplyMsg Error in Communications
  557. Jsr 180                ! terminate session
  558. Bell
  559. Alert -1 Warning: The MNP Status is unknown.\13The session has been terminated.
  560. Jump 200            ! exit to Cancel routine
  561. !
  562. !*********
  563. -LABEL 165    !---<MNP Status was Off>---
  564. !*********
  565. DisplyMsg Error in Communications
  566. Jsr 180                ! terminate session
  567. Bell
  568. Alert -1 Warning: The MNP Status is Off.\13The session has been terminated.
  569. Jump 200            ! exit to Cancel routine
  570. !
  571. !*********
  572. -LABEL 166    !---<MNP Status was Connecting>---
  573. !*********
  574. DisplyMsg Error in Communications
  575. Jsr 180                ! terminate session
  576. Bell
  577. Alert -1 Warning: The MNP Status is Connecting.\13The session has been terminated.
  578. Jump 200            ! exit to Cancel routine
  579. !
  580. !*********
  581. -LABEL 167    !---<MNP Status was Disconnecting>---
  582. !*********
  583. DisplyMsg Error in Communications
  584. Jsr 180                ! terminate session
  585. Bell
  586. Alert -1 Warning: The MNP Status is Disconnecting.\13The session has been terminated.
  587. Jump 200            ! exit to Cancel routine
  588. !
  589. !*********
  590. -LABEL 168    !---<MNP Status was not recognized>---
  591. !*********
  592. DisplyMsg Error in Communications
  593. Jsr 180                ! terminate session
  594. Bell
  595. Alert -1 MNPStatus was not recognized as a valid parameter.\13Call the Apple USA HelpLine.
  596. Jump 200            ! exit to Cancel routine
  597. !
  598. !*********
  599. -LABEL 169    !---<CTBCheckParameter error>---
  600. !*********
  601. DisplyMsg Error in Communications
  602. Jsr 180                ! terminate session
  603. Bell
  604. Alert -1 An error occurred in the CTBCheckParameter function.\13Call the Apple USA HelpLine.
  605. Jump 200            ! exit to Cancel routine
  606. !
  607. !*********
  608. -LABEL 170    !---<Success, we’re in, so exit>--- 
  609. !*********
  610. Wait 30                ! wait 0.5 secs
  611. Flush                ! clear input buffer
  612. Exit 0                ! exit the script normally
  613. !
  614. !================================================================================
  615. -LABEL 180-199    !***<Terminate Session>***
  616. !================================================================================
  617. !
  618. !*********
  619. -LABEL 180    !---<Terminate session>--- 
  620. !*********
  621. !    send Abnormal disconnect command
  622. Xmit C3\13
  623. !    Look for one of the following expected responses
  624. MatchStr 1 182 U#
  625. Wait 300            ! wait 5 secs
  626. Return
  627. !
  628. !*********
  629. -LABEL 182    !---<Say bye>---
  630. !*********
  631. Wait 6                ! wait 0.1 sec and sign off the network
  632. Xmit BYE\13
  633. Return
  634. !
  635. !================================================================================
  636. -LABEL 200    !***<Cancel Routine>***
  637. !================================================================================
  638. DsplyMsg Cancelling...
  639. Flush
  640. Wait 30                ! wait 0.5 secs
  641. Exit -1                ! exit the script with an error
  642. !
  643. !================================================================================
  644. -LABEL 210    !***<Hang up phone Routine>***
  645. !================================================================================
  646. !
  647. !    Look for one of the following expected responses
  648. MatchStr 1 222 CARRIER
  649. SetVar 1 0            ! clear # hangup tries counter
  650. SetVar 2 0            ! clear # modem config tries counter and reuse for MNPStatus checks
  651. ! If MNP is on, turn it off first or the modem will not understand the Hangup command
  652. !
  653. !    CTBCHECKPARAMETER <ParameterName> <ValueToCheckAgainst>
  654. !                      <LabelIfMatch> [<LabelIfParameterNotFound>] [<LabelIfError>]
  655. CTBCheckParameter MNPStatus Off 220 168 169            
  656. CTBCheckParameter MNPStatus Connecting 212 168 169
  657. CTBCheckParameter MNPStatus Disconnecting 213 168 169        
  658. !    CTBPARAMETER <ParameterName> <NewValue> [<LabelIfError>]
  659. CTBParameter MNPStatus Off 215        ! MNP was on, so turn it off
  660. !    Check it again, just in case
  661. CTBCheckParameter MNPStatus Off 220 168 169
  662. Jump 220            ! MNP turned off OK, so finish hanging up
  663. !
  664. !*********
  665. -LABEL 212    !---<MNPStatus is Connecting>---
  666. !*********
  667. IncVar 2            ! Increment # MNPstatus checks counter
  668. IfVar 2 3 214        ! if 3 checks, display alert and exit script with error
  669. Alert 200 MNPStatus is Connecting.
  670. Wait 30                ! wait 0.5 secs
  671. Jump 210            ! try to hang up again
  672. !
  673. !*********
  674. -LABEL 213    !---<MNPStatus is Disconnecting>---
  675. !*********
  676. IncVar 2            ! Increment # MNPstatus checks counter
  677. IfVar 2 3 214        ! if 3 checks, display alert and exit script with error
  678. Alert 200 MNPStatus is Disconnecting.
  679. Wait 30                ! wait 0.5 secs
  680. Jump 210            ! try to hang up again
  681. !
  682. !*********
  683. -LABEL 214    !---<MNPStatus is Connecting or Disconnecting>---
  684. !*********
  685. Alert 200 MNPStatus is still Connecting or Disconnecting.\13Script exiting with an error.
  686. Exit -1                ! exit the script with an error
  687. !
  688. !*********
  689. -LABEL 215    !---<CTBParameter Error>---    
  690. !*********
  691. Alert 200 CTBParameter MNPStatus Off caused an error.\13Call the Apple USA HelpLine.
  692. Exit -1                ! exit the script with an error
  693. !
  694. !*********
  695. -LABEL 220    !---<Hang up the phone subroutine>---
  696. !*********
  697. Wait 60                ! wait 1 sec (beginning guard time) and send +++ (escape)
  698. Xmit +
  699. Xmit +
  700. Xmit +
  701. Wait 60                ! wait 1 more sec (end guard time)
  702. Flush                ! clear input buffer and tell modem to hang up verbosely
  703. Xmit ATV1H\13
  704. !    Look for one of the following expected responses
  705. MatchStr 2 222 OK
  706. MatchStr 3 224 ERROR
  707. Wait 120            ! wait 2 secs
  708. Jump 224            ! test for error or no response            
  709. !
  710. !*********
  711. -LABEL 222    !---<Reset the modem>---
  712. !*********
  713. !
  714. IfVar 7 0 229        ! If NOT disconnecting, bypass the modem reset.
  715. !                      This aids in script debugging so we dont reset modem 1st time.
  716. Flush                ! Flush the buffer and send Hayes Reset Modem command
  717. Xmit ATZ\13
  718. !    Look for one of the following expected responses
  719. MatchStr 2 229 OK
  720. MatchStr 3 224 ERROR
  721. Wait 180            ! wait 3 secs
  722. !
  723. !*********
  724. -LABEL 224    !---<Error or just no response>---
  725. !*********
  726. IncVar 1            ! Increment # hangup tries counter
  727. IfVar 1 3 225        ! if 3 tries, display error alert and try again
  728. Jump 220            ! try to hangup again
  729. !
  730. !*********
  731. -LABEL 225    !---<Error>---
  732. !*********
  733. IfVar 7 1 229        ! If disconnecting, just return.
  734. Alert 200 The modem is not responding to the hangup command.\13Turn it off and then on again before retrying.
  735. SetVar 1 0            ! clear # hangup tries counter
  736. Jump 220            ! try to hangup again
  737. !
  738. !*********
  739. -LABEL 229    !---<Return from the Hangup sequence>---
  740. !*********
  741. Wait 60                ! wait 1 sec
  742. Flush                ! clear input buffer
  743. Return
  744. !
  745. !================================================================================
  746. -LABEL 230-239    !***<UNUSED>***
  747. !================================================================================
  748. !
  749. !================================================================================
  750. -LABEL 240    !***<Disconnection Sequence>***
  751. !================================================================================
  752. !
  753. !    If the connection is closed, we cant hangup, so just exit
  754. !    CTBIFCLOSED <LabelToGotoIfConnectionClosed>
  755. CTBIFCLOSED 246
  756. !
  757. SetVar 7 1            ! We're disconnecting, so set the flag
  758. !    Look for one of the following expected responses
  759. MatchStr 1 242 U#
  760. MatchStr 2 244 NO CARRIER
  761. Wait 60                ! wait 1 sec
  762. Jump 244            ! and hang up the phone
  763. !
  764. !*********
  765. -LABEL 242    !---<Sign off the network>---
  766. !*********
  767. Xmit BYE\13
  768. Wait 120            ! wait 2 secs
  769. !
  770. !*********
  771. -LABEL 244    !---<Hang up the phone>---
  772. !*********
  773. SetVar 1 0            ! clear the # hangup tries counter
  774. Jsr 210                ! Execute the Hang-up subroutine
  775. !    No CTBClose here because the connection is closed externally from the script
  776. !    in case we exited the script with an error before completion.
  777. Flush                ! clear input buffer
  778. Exit 0                ! exit the script normally
  779. !
  780. !*********
  781. -LABEL 246    !---<Connection Was Closed>---
  782. !*********
  783. Flush                ! clear input buffer
  784. Exit 0                ! exit the script normally
  785. ###
  786.